package com.qcby.train.mybaitsplusdemo.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.qcby.train.mybaitsplusdemo.entity.Student;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface StudentMapper extends BaseMapper<Student> {


    /**
     * @param page  分页参数，mybatis plus分页专用，mapper方法带这个参数，自动分页
     * @param student
     * @return
     */
    IPage<Student> listPageNew(@Param("student") Student student,IPage<Student> page);


    /**
     * @param page  分页参数，mybatis plus分页专用，mapper方法带这个参数，自动分页
     * @param student
     * @return   ctrl+alt+b
     */
    List<Student> listPage(@Param("student") Student student,IPage<Student> page);

    List<Student> listPage1(IPage<Student> page,@Param("student")Student student);

    List<Student> listPage2(IPage<Student> page,@Param(Constants.WRAPPER) LambdaQueryWrapper<Student> queryWrapper);

    List<Student> listPage3(IPage<Student> page,@Param(Constants.WRAPPER) QueryWrapper<Student> queryWrapper);


    List<Student> listStudentPage(IPage<Student> page,@Param("student")Student student);


    List<Student> listPage0521(IPage<Student> page,@Param(Constants.WRAPPER) QueryWrapper<Student> queryWrapper);

    List<Student> listPage052101(IPage<Student> page,@Param("student")Student student);

    IPage<Student> listPage052103(@Param("student")Student student,IPage<Student> page);

    List<Student> listPage052102(IPage<Student> page,@Param(Constants.WRAPPER) QueryWrapper<Student> queryWrapper);

    /**
     * nested exception is org.apache.ibatis.exceptions.TooManyResultsException:
     *  Expected one result (or null) to be returned by selectOne(), but found: 8
     * @param classInfoId
     * @return
     */
    Student selectByClassInfoId(@Param("classInfoId") Long classInfoId);

}
